package raceReservationServer.saxParser;

import java.util.List;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

public class Prueba 
{	 
	static List<GatewayObject> gatewaysXML;
	public static void main(String[] args) 
	{
	
		SAXParserFactory factory = SAXParserFactory.newInstance();        
	    factory.setValidating(true);
	    
	    try {
	    	System.out.println("Prueba de SAX");          
	    	SAXParser saxParser = factory.newSAXParser();
	        RaceServerGatewaysSAXHandler handler = new RaceServerGatewaysSAXHandler();                        
	        saxParser.parse("src/raceReservationServer/saxParser/gateway.xml", handler);
	        
	         gatewaysXML = handler.getGatewaysList();
	    } catch (Exception e) {
	        System.out.println("Error -> Main():" + e.getMessage());
	        e.printStackTrace();}
	      for  (int i=0; i<gatewaysXML.size();i++){
	    	  System.out.println("Server"+gatewaysXML.get(i).getDetails());
	    	  System.out.println("service" + gatewaysXML.get(i).getServiceName());
	    	  System.out.println("tech" + gatewaysXML.get(i).getTechnology());
	    	 }
	    }
}